<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %> 
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<html>
<head>
	<title><s:text name="pl.grabar.clinic.client.web.reception.patient.views.patient"/></title>
	<sj:head jqueryui="true" jquerytheme="flick" locale="%{locale}"/>
	<script type="text/javascript">
	 	function createObjectActionsRow(cellvalue, options, row) {
	 		return "<a href='edit?patientId=" + cellvalue + "'><s:text name='pl.grabar.clinic.client.web.buttons.edit'/></a>"
	 				+ "&nbsp;&nbsp;<a href='delete?patientId=" + cellvalue + "'><s:text name='pl.grabar.clinic.client.web.buttons.delete'/></a>"
	 				+ "&nbsp;&nbsp;<a href='preview?patientId=" + cellvalue + "'><s:text name='pl.grabar.clinic.client.web.buttons.preview'/></a>"
		}
	</script>
</head>
<body>
	<h1><s:text name="pl.grabar.clinic.client.web.labels.patients-list"/></h1>
	
	<s:url var="loadUrl" action="load"/>
	    <sjg:grid
		        id="gridtable"
		        dataType="json"
		        href="%{loadUrl}"
		        pager="true"
		        gridModel="data"
		        rowList="10,20,50,100"
		        rowNum="15"
		        rownumbers="true"
		        sortorder="asc"
		        autowidth="true"
		        shrinkToFit="true">
        <sjg:gridColumn name="firstName" title="%{getText('pl.grabar.clinic.client.web.labels.firstname')}" sortable="false"/>
        <sjg:gridColumn name="lastName" title="%{getText('pl.grabar.clinic.client.web.labels.lastname')}" sortable="false"/>
        <sjg:gridColumn name="gender" title="%{getText('pl.grabar.clinic.client.web.labels.gender')}" sortable="false"/>
        <sjg:gridColumn name="pesel" title="%{getText('pl.grabar.clinic.client.web.labels.pesel')}" sortable="false"/>
        <sjg:gridColumn name="dateOfBirth" title="%{getText('pl.grabar.clinic.client.web.labels.dateofbirth')}"  formatter="date" formatoptions="{newformat : 'd-m-Y', srcformat : 'Y-m-d H:i:s'}" sortable="false"/>
        <sjg:gridColumn name="id" title="%{getText('pl.grabar.clinic.client.web.labels.actions')}" sortable="false" formatter="createObjectActionsRow" width="80"/>
	    </sjg:grid>
    
    <input type="button" onclick="location.href='new'" value="<s:text name='pl.grabar.clinic.client.web.buttons.new'/>">
</body>
</html>